import axios from 'axios';
import AuthService from './AuthService';

const API_URL = '/api/users';

class UserService {
  getUserProfile() {
    return axios.get(`${API_URL}/profile`, { 
      headers: AuthService.getAuthHeader() 
    });
  }

  getUserById(id) {
    return axios.get(`${API_URL}/${id}`, { 
      headers: AuthService.getAuthHeader() 
    });
  }

  updateUser(id, userDetails) {
    return axios.put(`${API_URL}/${id}`, userDetails, { 
      headers: AuthService.getAuthHeader() 
    });
  }

  getAllUsers() {
    return axios.get(API_URL, { 
      headers: AuthService.getAuthHeader() 
    });
  }

  deleteUser(id) {
    return axios.delete(`${API_URL}/${id}`, {
      headers: AuthService.getAuthHeader()
    });
  }
}

export default new UserService(); 